from django.db import models
from houduan.utils.basemodels import BaseModel
# Create your models here.
from index.models import Shop
from product.models import User,OrderAddress



class OrderCart(BaseModel):
    user = models.ForeignKey(User, on_delete=models.PROTECT, verbose_name="订单用户")
    shop = models.ForeignKey(Shop, on_delete=models.PROTECT, verbose_name="商品")
    buyName = models.CharField(max_length=20, verbose_name='购买人')
    buyPhone = models.CharField(max_length=11)
    blessing = models.CharField(max_length=500, verbose_name='祝福语')
    count = models.IntegerField(verbose_name='购买数量')
    screateTime = models.DateTimeField()
    supdateTime = models.DateTimeField()
    imageUrl = models.ImageField(verbose_name='图片')
    name = models.CharField(max_length=10, verbose_name='商品名称')
    price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="实际金额")
    deliveryDate = models.DateTimeField()
    remarks = models.CharField(max_length=500)
    addrID = models.ForeignKey(OrderAddress,on_delete=models.PROTECT,verbose_name="订单地址号")
    status = models.IntegerField(default=0,verbose_name='支付状态0没1支付')
    data = models.CharField(max_length=22)

    class Meta:
        db_table = 't_order'
        verbose_name = '订单'
        verbose_name_plural = verbose_name